class treasure_buy_item  extends eui.ItemRenderer{
	public constructor() {
		super();

		this.skinName = "resource/skins/items/treasure_buy_item.exml";
 
		  this.addEventListener(eui.UIEvent.CREATION_COMPLETE, this.onComplete, this);
      	  this.imgTreasure.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onTouchTap,this);
          this.imgPriceBgWidth=this.imgPriceBg.width;
		  this.group.touchThrough = true;
		  EffectUtils.playEffect(this,1);
	}

    imgPriceBgWidth=0;
	group:eui.Group;
    imgTreasure:eui.Image;
    imgPriceBg:eui.Image;

	private onComplete() {
		 	//  console.log("onComplete..");
	}

	// 当数据改变时，更新视图
	protected dataChanged() {
        this.imgPriceBg.width=this.imgPriceBgWidth+this.data.price.length*6;
	}
    private onTouchTap(){
		Events.dispatch(Events.Type.TAP_TREASURE,this.data.qualityType);
	 	EffectUtils.blinkEffect(this,200);
    }
}
